/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.bc;

import edu.upn.sigemfi.gar.be.GarantiaHipotecaria;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;

/**
 *
 * @author Programador
 */
@Stateless
public class GarantiaHipotecariaFacade implements GarantiaHipotecariaFacadeLocal {
    //@PersistenceUnit(name="edu.upn.sigemfi.gar-ejbPU")
    @PersistenceContext
    private EntityManager em;

    public void create(GarantiaHipotecaria garantiaHipotecaria) {
        em.persist(garantiaHipotecaria);
    }

    public void edit(GarantiaHipotecaria garantiaHipotecaria) {
        em.merge(garantiaHipotecaria);
    }

    public void remove(GarantiaHipotecaria garantiaHipotecaria) {
        em.remove(em.merge(garantiaHipotecaria));
    }

    public GarantiaHipotecaria find(Object id) {
        return em.find(GarantiaHipotecaria.class, id);
    }

    public List<GarantiaHipotecaria> findAll() {
        return em.createQuery("select object(o) from GarantiaHipotecaria as o").getResultList();
    }

}
